from django.conf.urls.defaults import patterns, include, url
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'cardapio_digital.views.home', name='home'),
    # url(r'^cardapio_digital/', include('cardapio_digital.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
    
    #Esse mapeamento eh para carregar o menu inicial. Comeca na raiz do site
    (r'^$', 'cardapio.views.index'),
    
    #Esse mapeamento eh para invocar a funcao de criar formulario de cadastro de prato
    (r'^lista_de_usuarios/$', 'cardapio.views.lista_de_usuarios'),
    (r'^lista_de_clientes/$', 'cardapio.views.lista_de_clientes'),
    (r'^lista_de_pratos/$', 'cardapio.views.lista_de_pratos'),
    (r'^lista_de_bebidas/$', 'cardapio.views.lista_de_bebidas'),
    (r'^exibir_cardapio/$', 'cardapio.views.exibir_cardapio'),
    (r'^exibir_pedidos/$', 'cardapio.views.lista_de_pedidos'),
    (r'^exibir_comandas/$', 'cardapio.views.lista_de_comandas'),
    
    (r'^cadastrar_usuario/$', 'cardapio.views.cadastrar_usuario'),
    (r'^cadastrar_cliente/$', 'cardapio.views.cadastrar_cliente'),
    (r'^cadastrar_prato/$', 'cardapio.views.cadastrar_prato'),
    (r'^cadastrar_bebida/$', 'cardapio.views.cadastrar_bebida'),
    
    (r'^usuario/(?P<id_usuario>\d+)/$', 'cardapio.views.editar_usuario'),
    (r'^cliente/(?P<id_cliente>\d+)/$', 'cardapio.views.editar_cliente'),
    (r'^prato/(?P<id_prato>\d+)/$', 'cardapio.views.editar_prato'),
    (r'^bebida/(?P<id_bebida>\d+)/$', 'cardapio.views.editar_bebida'),
    
    (r'^login/$', 'django.contrib.auth.views.login', {'template_name':'login.html'}),
    (r'^logout/$', 'django.contrib.auth.views.logout_then_login', {'login_url':'/login/'}),
)

if settings.DEBUG:
    urlpatterns += patterns('',
                            (r'^media/(?P<path>.*)$',
                            'django.views.static.serve',
                            {'document_root': settings.MEDIA_ROOT}),
                            )
